#include <stdio.h>
#include <time.h>
#include <string.h>
#include <windows.h>
#include <conio.h>

#define APPLICATION_START_CONTROL 1

#define FILE_SETUP_MENU 1
#define LOGIN_MENU 2
#define MAIN_MENU 3

#define EXIT_MENU 0

typedef struct PET
{
	char name[50];
	char species[50];
	char birthDate[10];
}pet;

typedef struct USER
{
	int idNumber;
	char password[32];
	int type;
}user;

typedef struct OWNER
{
	int idNumber;
	char name[80];
	char address[100];
	char emailAddress[100];
}client,owner;

typedef struct VISIT
{
	char date[10];
	char serviceType[30];
	char additionalComments[125];
	double payment;
	//payment
}visit;

typedef struct DOCTOR
{
	int idNumber;
	char name[80];
	char address[100];
	char gender;
	char specialization[50];
	char degreeEarned[80];
	char dayoff[80];
	//and their current charges
}doctor;

int fileSetupMenu(void);
int mainMenuController(int,user *);
int loginMenu(user *);
int mainMenu(user *);
void position(int,int);

int main(void)
{
	mainDriver();

	return 0;
}

int mainDriver (void)
{
	int menuControlCode = APPLICATION_START_CONTROL;
	user currentUser;
	user *currentUserPtr = &currentUser;

	do
	{
		menuControlCode = mainMenuController(mainMenuController(menuControlCode,currentUserPtr),currentUserPtr);
	}while(menuControlCode != EXIT_MENU);

	return menuControlCode;
}

int mainMenuController (int menuControlCode, user *currentUserPtr)
{

	switch(menuControlCode)
	{
		case FILE_SETUP_MENU:
			return fileSetupMenu();
		break;

		case LOGIN_MENU:
			return loginMenu(currentUserPtr);
		break;

		case MAIN_MENU:
			return mainMenu(currentUserPtr);
		break;

	}

}

int fileSetupMenu(void)
{
	return LOGIN_MENU;
}

int loginMenu(user *currentUser)
{
	int userId;
	char password[32];

	position(20,8);
	printf("User ID:");
	position(29,8);
	scanf("%d",&userId);

	position(20,9);
	printf("Password:");
	position(30,8);
	scanf("%s",password);

	//find the record in the user file based on user id and compare the password.

	return MAIN_MENU;
}

int mainMenu(user *currentUser)
{
	return 0;
}

void position(int x, int y)
{
    HANDLE hOut;
    COORD cursorPosition;
    cursorPosition.X = x;
    cursorPosition.Y = y;
    hOut = GetStdHandle(STD_OUTPUT_HANDLE);
    SetConsoleCursorPosition(hOut,cursorPosition);
}
